// 用户信息接口
export interface UserInfo {
  id: string
  username: string
  email: string
  avatar: string
  role: string
  status: 'active' | 'inactive'
  lastLoginTime: string
  createTime: string
}

// 用户权限接口
export interface UserPermission {
  id: string
  name: string
  code: string
  description: string
  type: 'menu' | 'button' | 'api'
  parentId: string | null
  path?: string
  icon?: string
  order: number
}

// 用户角色接口
export interface UserRole {
  id: string
  name: string
  code: string
  description: string
  permissions: string[]
}

// 模拟用户数据
export const mockUsers: UserInfo[] = [
  {
    id: '1',
    username: 'admin',
    email: 'admin@example.com',
    avatar: 'https://avatars.githubusercontent.com/u/1?v=4',
    role: 'admin',
    status: 'active',
    lastLoginTime: '2024-03-20 10:30:00',
    createTime: '2024-01-01 00:00:00'
  },
  {
    id: '2',
    username: 'developer',
    email: 'developer@example.com',
    avatar: 'https://avatars.githubusercontent.com/u/2?v=4',
    role: 'developer',
    status: 'active',
    lastLoginTime: '2024-03-19 15:45:00',
    createTime: '2024-01-02 00:00:00'
  },
  {
    id: '3',
    username: 'user',
    email: 'user@example.com',
    avatar: 'https://avatars.githubusercontent.com/u/3?v=4',
    role: 'user',
    status: 'active',
    lastLoginTime: '2024-03-18 09:15:00',
    createTime: '2024-01-03 00:00:00'
  }
]

// 模拟权限数据
export const mockPermissions: UserPermission[] = [
  {
    id: '1',
    name: '系统管理',
    code: 'system',
    description: '系统管理模块',
    type: 'menu',
    parentId: null,
    path: '/system',
    icon: 'fas fa-cog',
    order: 1
  },
  {
    id: '2',
    name: '用户管理',
    code: 'system:user',
    description: '用户管理功能',
    type: 'menu',
    parentId: '1',
    path: '/system/user',
    icon: 'fas fa-users',
    order: 2
  },
  {
    id: '3',
    name: '角色管理',
    code: 'system:role',
    description: '角色管理功能',
    type: 'menu',
    parentId: '1',
    path: '/system/role',
    icon: 'fas fa-user-tag',
    order: 3
  },
  {
    id: '4',
    name: '插件管理',
    code: 'plugin',
    description: '插件管理模块',
    type: 'menu',
    parentId: null,
    path: '/plugin',
    icon: 'fas fa-puzzle-piece',
    order: 4
  },
  {
    id: '5',
    name: '数据统计',
    code: 'statistics',
    description: '数据统计模块',
    type: 'menu',
    parentId: null,
    path: '/statistics',
    icon: 'fas fa-chart-bar',
    order: 5
  }
]

// 模拟角色数据
export const mockRoles: UserRole[] = [
  {
    id: '1',
    name: '超级管理员',
    code: 'admin',
    description: '系统超级管理员',
    permissions: ['system', 'system:user', 'system:role', 'plugin', 'statistics']
  },
  {
    id: '2',
    name: '开发者',
    code: 'developer',
    description: '系统开发者',
    permissions: ['plugin', 'statistics']
  },
  {
    id: '3',
    name: '普通用户',
    code: 'user',
    description: '普通用户',
    permissions: ['plugin']
  }
]

// 模拟登录响应数据
export const mockLoginResponse = {
  code: 200,
  message: '登录成功',
  data: {
    token: 'mock-token-123456',
    userInfo: mockUsers[0],
    permissions: mockPermissions.map(p => p.code),
    roles: mockRoles.map(r => r.code)
  }
}

// 模拟用户会话数据
export const mockUserSession = {
  token: 'mock-token-123456',
  userInfo: mockUsers[0],
  permissions: mockPermissions.map(p => p.code),
  roles: mockRoles.map(r => r.code),
  expires: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString() // 24小时后过期
} 